import request from '@/utils/request'

//获取全部司机。
export function GetDriver(data){
    return request({
        url:'/delivery/driver',
        method:'get',
        data
    })
}
//分页查询。
export function paging(currentPage, count, deliveryDirverQuery){
    return request({
        url:`/delivery/driver/${currentPage}/${count}`,
        method:'post',
        data:deliveryDirverQuery
    })
}
//新增。
export function add(data){
   //这里对于两个多选框重新赋值( Boolean-> int )
    if(data.receiptsChangeAuthority == false){
        data.receiptsChangeAuthority = 0
    }else{
        data.receiptsChangeAuthority = 1
    }
    if(data.returnBillAuthority == false){
        data.returnBillAuthority = 0
    }else{
        data.returnBillAuthority = 1
    }
    return request({
        url:'/delivery/driver',
        method:'post',
        data
    })
}
//编辑。
export function edit(data){
    if(data.receiptsChangeAuthority == false){
        data.receiptsChangeAuthority = 0
    }else{
        data.receiptsChangeAuthority = 1
    }
    if(data.returnBillAuthority == false){
        data.returnBillAuthority = 0
    }else{
        data.returnBillAuthority = 1
    }
    return request({
        url:'/delivery/driver',
        method:'put',
        data
    })
}
//删除。
export function del(driverId){
    return request({
        url:`/delivery/driver/${driverId}`,
        method:'delete',
        data:driverId
    })
}